﻿using System;
using System.Collections.Generic;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using MISAPP.Classify.Service;
using MISAPP.MISInterface;

public partial class View_CIB_CIB001 : ViewMatrix //ViewCIB001 //System.Web.UI.Page
{
    bool ok = false;
    string msgStr = string.Empty;

    protected void Page_Load(object sender, EventArgs e)
    {
        msgStr = string.Empty;
        limit();
        serviceName = "MISAPP.Classify.Service.Service_CIB001";
        if (!IsPostBack)
        {
            FillCriteria("GetCriteriaData", "SetData");
            FillGroupBy("GetGroupBy", CLG_GroupBy);
        }
    }

    protected void btn_ExecuteClick(object sender, EventArgs e)
    {
        Execute();
        if (ok.Equals(false))
        {

            ScriptManager.RegisterStartupScript(this, this.GetType(), 
                "alert", msgStr, true);
            return; 
        }
        Server.Transfer("CIB001_Summary.aspx");
    }

    protected void Execute()
    {
        //FillControl();
        //Dictionary<string, List<string>> CriteriaList = GetSelectCLB();
        List<iSelectList> CriteriaList = GetSelectCLB();
        string GRPList = CLG_GroupBy.GetSelect();
        if (!Check(GRPList))
        { return; }

        Session["PageSize"] = ddlGVPageSizeSelect1.GetSelectPageSize();
        Session["Criteria"] = CriteriaList;
        Session["ExclusiveOfAccount"] = Utility.GetExclusiveAccont(chk_公庫.GetSelectValue());
        Session["GroupBy"] = GRPList;
        Session["Unit"] = ddlMoneyUnit1.GetSelectUnit();
        Session["AccNo"] = txtAccNo.Text;
  
    }

    protected bool Check(string p_select)
    {
        ok = true;
        if (p_select.Length == 0)
        {
            //TODO 檢查不過時，要顯示訊息
            msgStr = "alert('請選擇群組！')";
            ok = false;
        }
        return ok;
    }

    

}
